#include clientscripts\_utility;
#include clientscripts\_music;

main()
{
	clientscripts\createfx\camp_assault_fx::main();
	clientscripts\_fx::reportNumEffects();

	footsteps();
	precache_createfx_fx();
	precache_exploders();

	disableFX = GetDvarInt( "disable_fx" );
	if( !IsDefined( disableFX ) || disableFX <= 0 )
	{
		precache_scripted_fx();
	}

	addLightningExploder( 10001 );
	addLightningExploder( 10002 );
	addLightningExploder( 10003 );
	addLightningExploder( 10004 );
	addLightningExploder( 10005 );

	level.lightningNormalFunc = ::lightning_normal_func;
	level.lightningFlashFunc = ::lightning_flash_func;

	PrintLn( "*** Client : camp assault fx running..." );
}

precache_scripted_fx()
{
	level._effect["truck_headlights"]					   		  = loadfx("env/light/fx_ray_headlight_truck");
}

footsteps()
{
	clientscripts\_utility::setFootstepEffect( "asphalt", LoadFx( "bio/player/fx_footstep_dust" ) );
	clientscripts\_utility::setFootstepEffect( "brick", LoadFx( "bio/player/fx_footstep_dust" ) );
	clientscripts\_utility::setFootstepEffect( "carpet", LoadFx( "bio/player/fx_footstep_dust" ) );
	clientscripts\_utility::setFootstepEffect( "cloth", LoadFx( "bio/player/fx_footstep_dust" ) );
	clientscripts\_utility::setFootstepEffect( "concrete", LoadFx( "bio/player/fx_footstep_dust" ) );
	clientscripts\_utility::setFootstepEffect( "dirt", LoadFx( "bio/player/fx_footstep_sand" ) );
	clientscripts\_utility::setFootstepEffect( "foliage", LoadFx( "bio/player/fx_footstep_sand" ) );
	clientscripts\_utility::setFootstepEffect( "gravel", LoadFx( "bio/player/fx_footstep_dust" ) );
	clientscripts\_utility::setFootstepEffect( "grass", LoadFx( "bio/player/fx_footstep_dust" ) );
	clientscripts\_utility::setFootstepEffect( "metal", LoadFx( "bio/player/fx_footstep_dust" ) );
	clientscripts\_utility::setFootstepEffect( "mud", LoadFx( "bio/player/fx_footstep_mud" ) );
	clientscripts\_utility::setFootstepEffect( "paper", LoadFx( "bio/player/fx_footstep_dust" ) );
	clientscripts\_utility::setFootstepEffect( "plaster", LoadFx( "bio/player/fx_footstep_dust" ) );
	clientscripts\_utility::setFootstepEffect( "rock", LoadFx( "bio/player/fx_footstep_dust" ) );
	clientscripts\_utility::setFootstepEffect( "water", LoadFx( "bio/player/fx_footstep_water" ) );
	clientscripts\_utility::setFootstepEffect( "wood", LoadFx( "bio/player/fx_footstep_dust" ) );
}

precache_exploders()
{
	level._effect["lightning_strike"] = LoadFX( "maps/ber2/fx_ber2_lightning_flash" );
}

precache_createfx_fx()
{
	level._effect["insects_lantern1"] = LoadFX( "bio/insects/fx_insects_lantern_1" );
	level._effect["insects_lantern2"] = LoadFX( "bio/insects/fx_insects_lantern_2" );
	level._effect["campfire_smolder"] = LoadFX( "env/fire/fx_fire_campfire_smolder" );
	level._effect["campfire_medium"] = LoadFX( "maps/mak/fx_fire_camp_med" );
	level._effect["chimney_smoke"] = LoadFX( "maps/mak/fx_smoke_chimney_med" );
	level._effect["chimney_smoke_large"] = LoadFX( "env/smoke/fx_smoke_wood_chimney_lrg" );
	level._effect["searchlight_1"] = LoadFX( "misc/fx_spotlight_large" );
	level._effect["bats_circling"] = LoadFX( "bio/animals/fx_bats_circling" );
	level._effect["bats_swarm"] = LoadFX( "bio/animals/fx_bats_circling_swarm" );
	level._effect["floor_rays_large"] = LoadFX( "maps/mak/fx_ray_linear_large" );
	level._effect["floor_rays_medium"] = LoadFX( "maps/mak/fx_ray_linear_med" );
	level._effect["plume_collapse_dust"] = LoadFX( "explosions/fx_dust_cloud_plume_1" );
	level._effect["mist_rolling"] = LoadFX( "maps/mak/fx_fog_rolling_thin" );
	level._effect["mist_rolling2"] = LoadFX( "maps/mak/fx_fog_rolling_thin2" );
	level._effect["fire_barrel_medium"] = LoadFX( "env/fire/fx_fire_barrel_med" );
	level._effect["fire_barrel_small"] = LoadFX( "env/fire/fx_fire_barrel_small" );
	level._effect["glow_outdoor"] = LoadFX( "env/light/fx_glow_lampost_white_dim_static" );
	level._effect["glow_indoor"] = LoadFX( "env/light/fx_light_indoor_white_static" );
	level._effect["insects_swarm"] = LoadFX( "maps/mak/fx_insects_swarm" );
	level._effect["glow_spotlight"] = LoadFX( "env/light/fx_glow_spotlight_white_dim_static" );
	level._effect["sys_e_smoke_trail"] = LoadFX( "maps/mak/fx_sys_element_smoke_tail_small" );
	level._effect["fire_debris_small"] = LoadFX( "maps/mak/fx_fire_debris_small" );
	level._effect["fire_debris_med"] = LoadFX( "maps/mak/fx_fire_debris_med" );
	level._effect["fire_debris_large"] = LoadFX( "maps/mak/fx_fire_debris_large" );
	level._effect["fire_debris_large_direct"] = LoadFX( "maps/mak/fx_fire_debris_large_directional" );
	level._effect["glow_indoor_spot"] = LoadFX( "maps/mak/fx_light_glow_lantern_spot" );
	level._effect["fire_debris_large_single"] = LoadFX( "maps/mak/fx_fire_debris_large_single" );
	level._effect["fire_debris_ash_cloud"] = LoadFX( "maps/mak/fx_fire_debris_ash_cloud" );
	level._effect["fire_embers_patch"] = LoadFX( "maps/mak/fx_fire_debris_embers_patch" );
	level._effect["fire_embers_patch2"] = LoadFX( "maps/mak/fx_fire_debris_embers_patch2" );
	level._effect["fire_debris_med_line"] = LoadFX( "maps/mak/fx_fire_debris_med_line" );
	level._effect["fire_debris_med_line2"] = LoadFX( "maps/mak/fx_fire_debris_med_line2" );
	level._effect["fire_debris_med_line3"] = LoadFX( "maps/mak/fx_fire_debris_med_line3" );
	level._effect["fire_water_medium"] = LoadFX( "maps/mak/fx_fire_water_med" );
	level._effect["fire_water_small"] = LoadFX( "maps/mak/fx_fire_water_small" );
	level._effect["fire_smoke_column1"] = LoadFX( "maps/mak/fx_smoke_column" );
	level._effect["fire_smoke_column2"] = LoadFX( "maps/mak/fx_smoke_column2" );
	level._effect["fire_hut_d_light"] = LoadFX( "maps/mak/fx_fire_hut_d_light" );
	level._effect["god_ray_moon1"] = LoadFX( "maps/mak/fx_ray_linear_large_moon" );
	level._effect["god_ray_moon2"] = LoadFX( "maps/mak/fx_ray_linear_large_moon2" );
	level._effect["god_ray_moon3"] = LoadFX( "maps/mak/fx_ray_linear_large_moon3" );
	level._effect["god_ray_moon4"] = LoadFX( "maps/mak/fx_ray_linear_large_moon4" );
	level._effect["god_ray_fire"] = LoadFX( "maps/mak/fx_ray_linear_fire_small" );
	level._effect["god_ray_fire2"] = LoadFX( "maps/mak/fx_ray_linear_fire_medium" );
	level._effect["smoke_ambiance_indoor"] = LoadFX( "maps/mak/fx_smoke_ambiance_indoor" );
	level._effect["water_flow"] = LoadFX( "maps/mak/fx_water_wake_flow" );
	level._effect["water_splash_rocks"] = LoadFX( "maps/mak/fx_water_splash_rocks" );
	level._effect["water_wake_mist"] = LoadFX( "maps/mak/fx_water_wake_mist" );
	level._effect["water_wake_ripples"] = LoadFX( "maps/mak/fx_water_ripples_small" );
	level._effect["lantern_on_global"]	= LoadFX( "env/light/fx_lights_lantern_on" );
	level._effect["glow_candle"] = LoadFX( "env/light/fx_dlight_candle_glow" );
}

scripted_fx()
{
}

lightning_normal_func()
{
	//PrintLn( "*** Client : Lightning Normal Func()" );

	realWait( 0.05 );
	ResetSunLight();
	players = getlocalplayers();
	if(players.size == 1)
	{
		//setVolFog(250, 750, 400, -128, 0.44, 0.52, 0.44, 0);
	}
}

lightning_flash_func()
{
	//PrintLn( "*** Client : Lightning Flash Func()" );

	SetSunLight( 1, 1, 1.5 );
	players = getlocalplayers();
	if(players.size == 1)
	{
		//setVolFog(250, 550, 400, -128, 0.45, 0.45, 0.5, 0);
	}

	realWait( 0.014 );

	SetSunLight( 1.5, 1.5, 2 );

	players = getlocalplayers();
	if(players.size == 1)
	{
		//setVolFog(250, 550, 400, -128, 0.7, 0.7, 0.75, 0);
	}

	realWait( 0.0010 );

	SetSunLight( 5, 5, 5.5 );

	players = getlocalplayers();
	if(players.size == 1)
	{
		//setVolFog(250, 550, 400, -128, 0.5, 0.5, 0.55, 0);
	}
	realWait( 0.0011 );

	SetSunLight( 1, 1, 1.5 );

	players = getlocalplayers();
	if(players.size == 1)
	{
		//setVolFog(250, 550, 400, -128, 0.55, 0.55, 0.6, 0);
	}

	realWait( 0.0015 );

	SetSunLight( 2.5, 2.5, 3 );

	players = getlocalplayers();
	if(players.size == 1)
	{
		//setVolFog(250, 550, 400, -128, 0.65, 0.65, 0.7, 0);
	}
}